#ifndef __TASK_MANAGER__
#define __TASK_MANAGER__

#ifdef __cplusplus
extern "C" {
#endif

#include "lvgl.h"
#include "S_UART.h"
#include "string.h"
#include "my_game.h"
#include "mainpage.h"

typedef struct taskManager
{
    //contains all page flag;
    int isLoadingPageRunning;
    int Destory_LP_request;

    int isChooseGamePageRunning; //选择游戏的界面
    int Enter_BC_request;
    int Enter_Extra_request;
    int Enter_setting_request;

    int isBoxChoosePageRunning;//选择推箱子关卡的页面
    int BackTo_CG_request;
    int Enter_BoxGame_request;

    int isGamePageRunning;//推箱子游戏界面
    int Exit_Game_request;
    int Refresh_Game_request;

    int isSettingPageRunning;//设置的界面
    //设置页面共用了BackToCG

    int isExtraPageRunning;//额外界面
    //该页面也共用了BackToCG

}TaskMgr;

typedef struct loadingPage //最开始的加载界面
{
    lv_style_t img_style;
    lv_obj_t *imgMihoyo;
    lv_obj_t * main_container;
    lv_obj_t * obj_label;
    lv_style_t style_bg;    //滑动条的style
    lv_style_t style_indic;
    lv_obj_t * obj_bar;
    lv_anim_t anim;

}LP;

typedef struct chooseGame   //选择游戏界面结构体
{
    lv_obj_t* imgGirl;
    lv_obj_t* btn;
    lv_obj_t* main_container;
    lv_obj_t* game_box;
    lv_obj_t* game_box_label;
    lv_obj_t* game_test;
    lv_obj_t* Extra_label;
    lv_obj_t* settings;
    lv_obj_t* settings_label;
    lv_obj_t* obj_label;
    lv_obj_t* btn_label;
    lv_obj_t* game_select;

    void (*CG_getkey)();
}CG;

typedef struct box_chooselevel   //选择推箱子关卡结构体
{

    lv_obj_t *img_BG;
    lv_obj_t *level1;
    lv_obj_t *level1_label;
    lv_obj_t *level2;
    lv_obj_t *level2_label;
    lv_obj_t *level3;
    lv_obj_t *level3_label;
    lv_obj_t *level4;
    lv_obj_t *level4_label;
    lv_obj_t *level5;
    lv_obj_t *level5_label;
    lv_obj_t *btn;
    lv_obj_t *btn_label;
    lv_obj_t * main_container;
    lv_obj_t* level_select;
    lv_obj_t * obj_label;
    void (*CL_getkey)();

}box_CL;

extern lv_obj_t *src;

void taskmgrInit(TaskMgr * tm);
void del_LP(LP * page);
void create_CG(CG *page);
void del_CG(CG *page);
void create_box_level(box_CL* page);
void del_box_level(box_CL* page);
void create_box_game();
void printf_Mem();

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif